package com.xcc.factorypattern.demo02;

/**
 * @Description: SimplePizzaFactory
 * @Author: xiechuang
 * @Date: 2022/9/2
 */
public class SimplePizzaFactory {

    public Pizza createPizza(String type) {
        Pizza pizza;

        if ("cheese".equals(type)) {
            pizza = new CheesePizza();
        } else if ("greek".equals(type)) {
            pizza = new GreekPizza();
        } else if ("pepperoni".equals(type)) {
            pizza = new PepperoniPizza();
        } else {
            pizza = new CheesePizza();
        }

        return pizza;
    }

}
